package argirithm;

import java.util.Arrays;

/**统计每个英文大写字符出现的个数, 找出最多的前10个字符*/
public class lx1 {
    public static void main(String[] args) {
        int[][] arr = new int[26][2];
        for (char c = 'A'; c <='Z' ; c++) {
            arr[c-'A'][0] = c;
        }
        String str = "DASDMKLASMXKLAMKOPDFQWD";
        for (int i = 0; i <str.length() ; i++) {
            char c = str.charAt(i);
            if (c>='A'&&c<='Z'){
                arr[c-'A'][1]++;
            }
        }
        Arrays.sort(arr,(arr1,arr2) -> arr2[1] - arr1[1]);
        for (int[] arr1:arr) {
            System.out.println((char)(arr1[0])+":"+arr[1]);
        }
    }
}
